package com.zrf.control;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import com.zrf.service.LeaveService;

@RequestMapping("/leave")
@Controller
public class LeaveControl {

	@Autowired
	private LeaveService ls;
	@RequestMapping(value="sqj", params={"name"})
	public String studentQingjia(@RequestParam("name") String name){
		if (ls.leave(name)) {
			return "redirect:/user/first?name="+name+"&type=0";
		}
		return "fail";
	}
	@RequestMapping(value="tsp", params={"name","id","state"})
	public String flow(@RequestParam("name") String name,
								@RequestParam("state") Integer state,
								@RequestParam("id") Integer id){
		if (ls.flow(name, state, id)) {
			return "redirect:/user/first?name="+name+"&type=1";
		}
		return "fail";
	}
}
